#include <reg52.h>

sbit dula = P2^6;
sbit wela = P2^7;

unsigned int temp, bai, shi, ge;
unsigned int code table[] = {
			0x3f, 0x06, 0x5b, 0x4f,
			0x66, 0x6d, 0x7d, 0x07,
			0x7f, 0x6f };

void delay(unsigned int k)
{
	unsigned int i, j;
	for (j = k; j > 0; j--)
		for (i = k; i > 0; i--);
}

void main()
{
	temp = 256;
	bai = temp / 100;
	shi = (temp % 100) / 10;
	ge = temp % 10;
	while (1)
	{
		wela = 1;
		P0 = 0xf7;
		wela = 0;
		dula = 1;
		P0 = table[bai];
		dula = 0;
		delay(200);
		
		wela = 1;
		P0 = 0xef;
		wela = 0;
		dula = 1;
		P0 = table[shi];
		dula = 0;
		delay(200);
		
		wela = 1;
		P0 = 0xdf;
		wela = 0;
		dula = 1;
		P0 = table[ge];
		dula = 0;
		delay(200);		
	}
}